function [qw, qp] = quad_rule_1d(precision)
switch precision
    case 0
	q = [0.0  1.0];

    case 2
	 q = [0.500000000	 0.500000000; ...
            -0.500000000	 0.500000000];

    case 6
	q = [ ...
	 0.211324865	 0.250000000 ;...
	 0.788675135	 0.250000000 ;...
	-0.211324865	 0.250000000 ;...
	-0.788675135	 0.250000000];

    case 10
	q = [ ...
	 0.112701665	 0.138888889 ;...
	 0.500000000	 0.222222222 ;...
	 0.887298335	 0.138888889 ;...
	-0.112701665	 0.138888889 ;...
	-0.500000000	 0.222222222 ;...
	-0.887298335	 0.138888889];

    case 14
	q = [ ...
	 0.069431844	 0.086963711  ;...
	 0.330009478	 0.163036289 ;...
	 0.669990522	 0.163036289 ;...
	 0.930568156	 0.086963711 ;...
	-0.069431844	 0.086963711 ;... 
	-0.330009478	 0.163036289 ;...
	-0.669990522	 0.163036289 ;...
	-0.930568156	 0.086963711];

    case 18
	q = [ ...
	 0.046910077	 0.059231721 ;...
	 0.230765345	 0.119657168 ;...
	 0.500000000	 0.142222222 ;...
	 0.769234655	 0.119657168 ;...
	 0.953089923	 0.059231721 ;...
	-0.046910077	 0.059231721 ;...
	-0.230765345	 0.119657168 ;...
	-0.500000000	 0.142222222 ;...
	-0.769234655	 0.119657168 ;...
	-0.953089923	 0.059231721];

    case 22
	q = [...
	 0.033765243	 0.042831123 ;...
	 0.169395307	 0.090190393 ;...
	 0.380690407	 0.116978484 ;...
	 0.619309593	 0.116978484 ;...
	 0.830604693	 0.090190393 ;...
	 0.966234757	 0.042831123 ;...
	-0.033765243	 0.042831123 ;...
	-0.169395307	 0.090190393 ;...
	-0.380690407	 0.116978484 ;...
	-0.619309593	 0.116978484 ;...
	-0.830604693	 0.090190393 ;...
	-0.966234757	 0.042831123];

    case 26
	q = [ ...
	 0.025446044	 0.032371242 ;...
	 0.129234407	 0.069926348 ;...
	 0.297077424	 0.095457513 ;...
	 0.500000000	 0.104489796 ;...
	 0.702922576	 0.095457513 ;...
	 0.870765593	 0.069926348 ;...
	 0.974553956	 0.032371242 ;...
	-0.025446044	 0.032371242 ;...
	-0.129234407	 0.069926348 ;...
	-0.297077424	 0.095457513 ;...
	-0.500000000	 0.104489796 ;...
	-0.702922576	 0.095457513 ;...
	-0.870765593	 0.069926348 ;...
	-0.974553956	 0.032371242];

    case 30
	q = [
	 0.019855072	 0.025307134 ;...
	 0.101666761	 0.055595259 ;...
	 0.237233795	 0.078426661 ;...
	 0.408282679	 0.090670946 ;... 
	 0.591717321	 0.090670946 ;...
	 0.762766205	 0.078426661 ;...
	 0.898333239	 0.055595259 ;...
	 0.980144928	 0.025307134 ;...
	-0.019855072	 0.025307134 ;...
	-0.101666761	 0.055595259 ;...
	-0.237233795	 0.078426661 ;...
	-0.408282679	 0.090670946 ;...
	-0.591717321	 0.090670946 ;...
	-0.762766205	 0.078426661 ;...
	-0.898333239	 0.055595259 ;...
	-0.980144928	 0.025307134];

    case 34
	q = [ ...
	 0.015919880	 0.020318597 ;...
	 0.081984446	 0.045162040 ;...
	 0.193314284	 0.065152674 ;...
	 0.337873288	 0.078086769 ;...
	 0.500000000	 0.082559839 ;...
	 0.662126712	 0.078086769 ;...
	 0.806685716	 0.065152674 ;...
	 0.918015554	 0.045162040 ;...
	 0.984080120	 0.020318597 ;...
	-0.015919880	 0.020318597 ;...
	-0.081984446	 0.045162040 ;...
	-0.193314284	 0.065152674 ;...
	-0.337873288	 0.078086769 ;...
	-0.500000000	 0.082559839 ;...
	-0.662126712	 0.078086769 ;...
	-0.806685716	 0.065152674 ;...
	-0.918015554	 0.045162040 ;...
	-0.984080120	 0.020318597];

    case 38
	q = [ ...
	 0.013046736	 0.016667836 ;...
	 0.067468317	 0.037362837 ;...
	 0.160295216	 0.054771591 ;...
	 0.283302303	 0.067316680 ;...
	 0.425562830	 0.073881056 ;...
	 0.574437170	 0.073881056 ;...
	 0.716697697	 0.067316680 ;...
	 0.839704784	 0.054771591 ;...
	 0.932531683	 0.037362837 ;...
	 0.986953264	 0.016667836 ;...
	-0.013046736	 0.016667836 ;...
	-0.067468317	 0.037362837 ;...
	-0.160295216	 0.054771591 ;...
	-0.283302303	 0.067316680 ;...
	-0.425562830	 0.073881056 ;...
	-0.574437170	 0.073881056 ;...
	-0.716697697	 0.067316680 ;...
	-0.839704784	 0.054771591 ;...
	-0.932531683	 0.037362837 ;...
	-0.986953264	 0.016667836];

    otherwise
        error(['do not support one dimensional quadrature rule with precision ' num2str(precision)]);
end

    qw = q(:,2);
    qp = 0.5*(q(:,1) + 1);  % master element is assumed to be [0,1]

end